<div class="problemindexholder" problemindex="B">
 <div class="ttypography">
  <div class="problem-statement">
   <div class="header">
    <div class="title">
     B. Flag of Berland
    </div>
    <div class="time-limit">
     <div class="property-title">
      time limit per test
     </div>
     1 second
    </div>
    <div class="memory-limit">
     <div class="property-title">
      memory limit per test
     </div>
     256 megabytes
    </div>
    <div class="input-file">
     <div class="property-title">
      input
     </div>
     standard input
    </div>
    <div class="output-file">
     <div class="property-title">
      output
     </div>
     standard output
    </div>
   </div>
   <div>
    <p>
     The flag of Berland is such rectangular field
     <span class="tex-span">
      <i>
       n
      </i>
      ×
      <i>
       m
      </i>
     </span>
     that satisfies following conditions:
    </p>
    <ul>
     <li>
      Flag consists of three colors which correspond to letters
      <span class="tex-font-style-tt">
       'R'
      </span>
      ,
      <span class="tex-font-style-tt">
       'G'
      </span>
      and
      <span class="tex-font-style-tt">
       'B'
      </span>
      .
     </li>
     <li>
      Flag consists of three equal in width and height stripes, parralel to each other and to sides of the flag. Each stripe has
      <span class="tex-font-style-bf">
       exactly one color
      </span>
      .
     </li>
     <li>
      Each color should be used in
      <span class="tex-font-style-bf">
       exactly one stripe
      </span>
      .
     </li>
    </ul>
    <p>
     You are given a field
     <span class="tex-span">
      <i>
       n
      </i>
      ×
      <i>
       m
      </i>
     </span>
     , consisting of characters
     <span class="tex-font-style-tt">
      'R'
     </span>
     ,
     <span class="tex-font-style-tt">
      'G'
     </span>
     and
     <span class="tex-font-style-tt">
      'B'
     </span>
     . Output "
     <span class="tex-font-style-tt">
      YES
     </span>
     " (without quotes) if this field corresponds to correct flag of Berland. Otherwise, print "
     <span class="tex-font-style-tt">
      NO
     </span>
     " (without quotes).
    </p>
   </div>
   <div class="input-specification">
    <div class="section-title">
     Input
    </div>
    <p>
     The first line contains two integer numbers
     <span class="tex-span">
      <i>
       n
      </i>
     </span>
     and
     <span class="tex-span">
      <i>
       m
      </i>
     </span>
     (
     <span class="tex-span">
      1 ≤
      <i>
       n
      </i>
      ,
      <i>
       m
      </i>
      ≤ 100
     </span>
     ) — the sizes of the field.
    </p>
    <p>
     Each of the following
     <span class="tex-span">
      <i>
       n
      </i>
     </span>
     lines consisting of
     <span class="tex-span">
      <i>
       m
      </i>
     </span>
     characters
     <span class="tex-font-style-tt">
      'R'
     </span>
     ,
     <span class="tex-font-style-tt">
      'G'
     </span>
     and
     <span class="tex-font-style-tt">
      'B'
     </span>
     — the description of the field.
    </p>
   </div>
   <div class="output-specification">
    <div class="section-title">
     Output
    </div>
    <p>
     Print "
     <span class="tex-font-style-tt">
      YES
     </span>
     " (without quotes) if the given field corresponds to correct flag of Berland . Otherwise, print "
     <span class="tex-font-style-tt">
      NO
     </span>
     " (without quotes).
    </p>
   </div>
   <div class="sample-tests">
    <div class="section-title">
     Examples
    </div>
    <div class="sample-test">
     <div class="input">
      <div class="title">
       Input
      </div>
      <pre>6 5<br/>RRRRR<br/>RRRRR<br/>BBBBB<br/>BBBBB<br/>GGGGG<br/>GGGGG<br/></pre>
     </div>
     <div class="output">
      <div class="title">
       Output
      </div>
      <pre>YES<br/></pre>
     </div>
     <div class="input">
      <div class="title">
       Input
      </div>
      <pre>4 3<br/>BRG<br/>BRG<br/>BRG<br/>BRG<br/></pre>
     </div>
     <div class="output">
      <div class="title">
       Output
      </div>
      <pre>YES<br/></pre>
     </div>
     <div class="input">
      <div class="title">
       Input
      </div>
      <pre>6 7<br/>RRRGGGG<br/>RRRGGGG<br/>RRRGGGG<br/>RRRBBBB<br/>RRRBBBB<br/>RRRBBBB<br/></pre>
     </div>
     <div class="output">
      <div class="title">
       Output
      </div>
      <pre>NO<br/></pre>
     </div>
     <div class="input">
      <div class="title">
       Input
      </div>
      <pre>4 4<br/>RRRR<br/>RRRR<br/>BBBB<br/>GGGG<br/></pre>
     </div>
     <div class="output">
      <div class="title">
       Output
      </div>
      <pre>NO<br/></pre>
     </div>
    </div>
   </div>
   <div class="note">
    <div class="section-title">
     Note
    </div>
    <p>
     The field in the third example doesn't have three parralel stripes.
    </p>
    <p>
     Rows of the field in the fourth example are parralel to each other and to borders. But they have different heights —
     <span class="tex-font-style-tt">
      2
     </span>
     ,
     <span class="tex-font-style-tt">
      1
     </span>
     and
     <span class="tex-font-style-tt">
      1
     </span>
     .
    </p>
   </div>
  </div>
  <p>
  </p>
 </div>
</div>
